package com.lyz.dataStructure.JianZhiOffer;/**
 * @Author:759057893@qq.com Lyz
 * @Date: ${Date} 21:37
 * @Description:
 **/

import java.util.Scanner;

/**
 *@Author:759057893@qq.com Lyz
 *@Date: 2019/6/20 21:37
 *@Description:
 **/

/*
给定一个double类型的浮点数base和int类型的整数exponent。求base的exponent次方。
 */
public class Test16 {

    public static double Power(double base, int exponent) {
        if(exponent==0){
            return 1;
        }
        if(exponent==1){
            return base;
        }
        if(exponent==-1){
            return 1/base;
        }
       double sum =base;
        double sum1 =0;
        if(exponent>=2){
            for(int i =2;i<=exponent;i++){
                sum = base*sum;
                 sum1 = sum;
            }
        }else if(exponent<0){
            for(int i =-2;i>=exponent;i--){
                sum =base*sum;
                 sum1 = 1/sum;
            }
        }
        return sum1;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()){
           double b = sc.nextDouble();
           int n = sc.nextInt();
           double c =Power(b,n);
            System.out.println(c);
        }
    }
}
